package com.yt.dor.service;

import com.yt.dor.models.vo.DormBuildingVO;
import com.yt.dor.models.vo.DormRoomVO;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.BeanUtils;
import javax.annotation.Resource;
import com.yt.dor.common.config.YmlConfig;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.yt.dor.mapper.DormRoomMapper;
import com.yt.dor.models.service.IDormRoomService;
import com.yt.dor.models.bo.DormRoomSaveBO;
import com.yt.dor.models.dto.DormRoomDTO;

import java.util.List;

/**
 * 宿舍房间表控制器
 *
 * @author thekai
 * @Date 2025-10-21 14:13:41
 */
@DubboService
public class DormRoomServiceImpl extends ServiceImpl<DormRoomMapper, DormRoomDTO> implements IDormRoomService{

    @Resource
    private YmlConfig ymlConfig;
    @Resource
    private DormRoomMapper dormRoomMapper;


    @Override
    public boolean add(DormRoomSaveBO saveBO) {
        DormRoomDTO dto = new DormRoomDTO();
        BeanUtils.copyProperties(saveBO,dto);
        Long id = ymlConfig.getPkId();
        dto.setId(id);
        return this.insert(dto);
    }

    @Override
    public List<DormRoomVO> queryDormRoom(){
        List<DormRoomVO> dormRoomVOS =dormRoomMapper.query();
        return dormRoomVOS;
    }
}
